package com.lc.afbx.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.lc.afbx.BaseApplication;
import com.lc.afbx.R;
import com.lc.afbx.conn.GetApiLiPeiResult;
import com.lc.afbx.util.TimeUtil;

import java.util.List;

/**
 * Created by Administrator on 2016/7/7.
 */
public class LiPeiCheXianAdapter extends BaseAdapter {
    private Context context;
    private List<GetApiLiPeiResult.Data> dataList;

    public LiPeiCheXianAdapter(Context context, List<GetApiLiPeiResult.Data> dataList) {
        this.context = context;
        this.dataList = dataList;
    }


    @Override
    public int getCount() {
        return dataList.size();
    }

    @Override
    public Object getItem(int position) {
        return dataList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder holder = new ViewHolder();
        if (convertView == null) {

            convertView = LayoutInflater.from(context).inflate(R.layout.item_lipei_cx, null);
            BaseApplication.ScaleScreenHelper.loadView((ViewGroup) convertView);

            holder.name = (TextView) convertView.findViewById(R.id.name);
            holder.date = (TextView) convertView.findViewById(R.id.date);
            holder.pay = (TextView) convertView.findViewById(R.id.pay);

            convertView.setTag(holder);

        } else {
            holder = (ViewHolder) convertView.getTag();
        }


        holder.name.setText(dataList.get(position).address);
        holder.date.setText(dataList.get(position).accidentdate);
        holder.pay.setText(dataList.get(position).price);

        return convertView;
    }

    class ViewHolder {

        TextView name, date, pay;
    }

}
